import java.io.*;
public class Main {
	static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
	static StringBuilder sb = new StringBuilder();
	static String[][] card = new String[6][];
	public static void main(String[] args) throws IOException {
		String input;
		int i;
		for(i = 0; i < card.length; i++) {
			input = bf.readLine();
			card[i] = input.split(","); 
		}
		getCombo(0, "");
		System.out.print(sb);
	}
	
	static void getCombo(int col, String comboStr) {
		if(col == card.length) {
			sb.append(comboStr);
			return;
		}
		int i;
		for(i = 0; i < card[col].length; i++)
			if(col == card.length - 1) getCombo(col + 1, comboStr + card[col][i] + "\n");
			else getCombo(col + 1, comboStr + card[col][i] + ",");
	}
}